package extensions.android.network;

import java.io.IOException;

import extensions.android.Client;
import extensions.android.Client.StatusMessageSendable;

public class Connection
{
	private static final int CLIENT_PORT = 7888;
	
	private static Connection _instance;
	
	public static Connection getInstance()
	{
		if (_instance == null)
			_instance = new Connection();
		
		return _instance;
	}
	
	public Connection()
	{
		System.out.println("Creado objeto connection");
	}
	
	private Client _client;
	
	public Client getClient()
	{
		return _client;
	}
	
	public String Name = "";//FIXME: poner bien
	
	public void connect(String ip) throws IOException
	{

		_client = new Client(ip, CLIENT_PORT, new StatusMessageSendable() {
			
			@Override
			public void sendMessage(String msg)
			{
				System.out.println(msg);
			}
		});
		
		_client.connect();
	}

}
